package net.xinqushi.exceptions;

import java.io.FileNotFoundException;

/**
 * 被捕获的异常 , 进入Throwable#printStackTrace()
 * 未被捕获异常 ，JVM调用。进入{@link Thread#dispatchUncaughtException}方法
 * @see  java.lang.Throwable#printStackTrace()
 * @see  java.lang.Thread#dispatchUncaughtException
 */
public class ThrowableTest {
    public static void main(String[] args) throws FileNotFoundException {
        test3();
        System.out.println(123);
    }
    static void test(){
        test2();
    }
    static void test0(){
        try {
            throw new Throwable("fuck man",new Throwable("cause"));
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }
    static void test1(){
        try {
            throw new FileNotFoundException("file not found ..");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    static void test2(){

        throw new NullPointerException(" file not found .. ");

    }

    static void test3() throws FileNotFoundException {

        throw new FileNotFoundException(" .. is null ");

    }

}
